#pragma once

#include <common.h>

namespace riscv {
  class Regs;

  enum class Reg {
    x0,   x1, x2, x3, x4, x5, x6, x7, x8,     x9, x10, x11, x12, x13, x14, x15, x16,
    zero, ra, sp, gp, tp, t0, t1, t2, s0, fp, s1, a0,  a1,  a2,  a3,  a4,  a5,  a6,

    x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x30, x31,
    a7,  s2,  s3,  s4,  s5,  s6,  s7,  s8,  s9,  s10, s11, t3,  t4,  t5,  t6,
  };

  enum class FReg {
    f0,  f1,  f2,  f3,  f4,  f5,  f6,  f7,  f8,  f9,  f10, f11, f12, f13, f14, f15, f16,
    ft0, ft1, ft2, ft3, ft4, ft5, ft6, ft7, fs0, fs1, fa0, fa1, fa2, fa3, fa4, fa5, fa6,

    f17, f18, f19, f20, f21, f22, f23, f24, f25, f26,  f27,  f28, f29, f30,  f31,
    fa7, fs2, fs3, fs4, fs5, fs6, fs7, fs8, fs9, fs10, fs11, ft8, ft9, ft10, ft11,
  };

  class Regs {
  public:

    static Reg get_arg_reg(int index);
    static FReg get_arg_freg(int index);
    static std::string get_reg_name(Reg reg);
    static std::string get_reg_name(FReg reg);
  };
}
